package com.mdd.front.controller;

import com.mdd.common.aop.NotLogin;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.front.LikeFrontThreadLocal;
import com.mdd.front.service.StoreFrontService;
import com.mdd.front.vo.store.StoreHistoryVo;
import com.mdd.front.vo.store.StoreVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 *
 * {@code @Description}
 * {@code @Author} 幻速
 * {@code @Date} 2023/11/1 18:09
 **/
@RestController
@RequestMapping("api/store")
@Api(tags = "店铺管理")
public class StoreController {
    //店铺信息
    @Resource
    StoreFrontService storeFrontService;
    @NotLogin
    @GetMapping("/storeInfo")
    @ApiOperation(value="店铺信息")
    public AjaxResult<StoreVo> storeInfo(@Validated @IDMust() @RequestParam("storeId") Long storeId) {
        return AjaxResult.success(storeFrontService.storeInfo(storeId));
    }

    @GetMapping("/historyStore")
    @ApiOperation(value="获取历史服务商店铺")
    public AjaxResult<List<StoreHistoryVo>> historyStore() {
        return AjaxResult.success(storeFrontService.historyStore(LikeFrontThreadLocal.getUserId()));
    }
}
